package com.jkoss.common.tag;

import java.io.IOException;
import java.math.BigDecimal;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import com.jkoss.common.util.CommonUtil;

public class NumberFormat extends TagSupport {

	private String num;

	public void setNum(String num) {
		this.num = num;
	}

	public int doStartTag() throws JspException {
		JspWriter out = pageContext.getOut();
		try {
			if (!CommonUtil.isBlank(num)) {
				BigDecimal bigDecimal = new BigDecimal(num);
				bigDecimal = bigDecimal.multiply(new BigDecimal("0.01"));
				out.write(bigDecimal.toString());
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return SKIP_BODY; // return BodyTagSupport.EVAL_BODY_INCLUDE; 返回此则执行标签body中内容，SKIP_BODY则不执行
	}

}
